package demo01_useThread;

import lombok.SneakyThrows;

/**
 * @author liujun
 * @version 1.0
 * @date 2020/10/26
 * @author—Email liujunfirst@outlook.com
 * @blogURL https://blog.csdn.net/ljfirst
 * @description 使用线程来实现简单的定时器
 */
public class demo1 {

    public static void main(String[] args) {
        final long inter_time = 2 * 1_000;

        new Thread() {
            @SneakyThrows(InterruptedException.class)
            @Override
            public void run() {
                while (true) {
                    Thread.sleep(inter_time);
                    System.out.println("i am schedule");
                }
            }
        }.start();
    }
}
